package com.cn.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class MyLisntener implements HttpSessionListener
,ServletRequestListener,ServletContextListener,HttpSessionAttributeListener{

	int count=0;
	@Override
	public void sessionCreated(HttpSessionEvent arg0) {
		System.out.println("sessoin创建了"+arg0.getSession());
		System.out.println("count="+(++count));
	}
	@Override
	public void sessionDestroyed(HttpSessionEvent arg0) {
		System.out.println("sessoin失效了"+arg0.getSession());
	}
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		//System.out.println("contextDestroyed"+arg0.getServletContext());
	}
	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		//System.out.println("contextInitialized"+arg0.getServletContext());
	}
	@Override
	public void requestDestroyed(ServletRequestEvent arg0) {
		//System.out.println("requestDestroyed"+arg0.getServletRequest());
	}
	@Override
	public void requestInitialized(ServletRequestEvent arg0) {
		//System.out.println("requestInitialized"+arg0.getServletRequest());
	}
	@Override
	public void attributeAdded(HttpSessionBindingEvent arg0) {
		System.out.println("属性添加"+arg0.getName());
	}
	@Override
	public void attributeRemoved(HttpSessionBindingEvent arg0) {
		System.out.println("属性删除"+arg0.getName());
	}
	@Override
	public void attributeReplaced(HttpSessionBindingEvent arg0) {
		System.out.println("属性替换");
	}
}
